package com.ant.xmla.datacrawling.utils.pageUtil;

import javax.persistence.criteria.CriteriaBuilder;

/**
 * Created by IntelliJ IDEA.
 * 分页
 * @Author 中国蚂蚁技术有限公司
 * @create 2020/9/6 14:49
 */
public class PageDevice {
    //总条数
    private String totalCount;
    //当前页数
    private Integer pageNum=1;
    //开始页数
    private String startPageNum;
    //每页总条数
    private String pageSize="30";
    //总页数
    private Integer pageTotal;

    public PageDevice(String totalCount,String pageSize){
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        int tc = Integer.parseInt(totalCount);
        int ps = Integer.parseInt(pageSize);
        this.pageTotal=(tc+ps-1)/ps;
    }

    public Integer getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(Integer pageTotal) {
        this.pageTotal = pageTotal;
    }
    public String getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(String totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public String getStartPageNum() {
        return startPageNum;
    }

    public void setStartPageNum(String startPageNum) {
        this.startPageNum = startPageNum;
    }

    public String getPageSize() {
        return pageSize;
    }

    public void setPageSize(String pageSize) {
        this.pageSize = pageSize;
    }

    @Override
    public String toString() {
        return "PageDevice{" +
                "totalCount='" + totalCount + '\'' +
                ", pageNum=" + pageNum +
                ", startPageNum='" + startPageNum + '\'' +
                ", pageSize='" + pageSize + '\'' +
                ", pageTotal=" + pageTotal +
                '}';
    }
}
